<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Shuka189\Controller;

/**
 * Description of Index
 *
 * @author SoChishun
 */
class Index extends Appbase {

    public function index() {
        $m_goods = new \XWAM\Model\ProductGoodsModel();
        $shangpinlist = $m_goods->select(array('order' => 'id desc', 'limit' => 20));
        $tuijianlist = $m_goods->select(array('order' => 'id desc', 'limit' => 6));
        $cuxiaolist = $m_goods->select(array('order' => 'id desc', 'limit' => 4));
        $mDocument = new \XWAM\Model\ArticleModel();
        $noticeslist = $mDocument->select();
        $this->assign('tuijianlist', $tuijianlist);
        $this->assign('cuxiaolist', $cuxiaolist);
        $this->assign('shangpinlist', $shangpinlist);
        $this->assign('noticeslist', $noticeslist);
        $this->display();
    }

    public function fix() {
        M()->execute('update t_porg_product_goods g left join t_porg_product_category c on g.ex_tags=c.code set g.category_id=c.id');
        echo 'ok';
    }

}
